package cn.tedu.submarine;

import javax.swing.ImageIcon;

/**
 * 侦察潜艇类
 */
public class ObserveSubmarine extends SeaObject implements EnemyScore {
    private int observeSubmIndex = 0;

    public ObserveSubmarine() {
        super(115, 83);
    }

    public void move() {
        setX(getX() + getSpeed());
    }

    int osIndex = 0;
    int moIndex = 0;
    int boomIndex = 0;

    public ImageIcon getImage() {//画狮子(潜艇)
        if (isLive()) {
            if (++osIndex % 10 == 0) {
                return Images.obsersubm[observeSubmIndex++ % 5];
            } else {
                return Images.obsersubm[observeSubmIndex % 5];
            }
        } else {
            if (++moIndex % 10 == 0) {
                boomIndex++;
                if (boomIndex == 10) {
                    setState(REMOVE);
                    return Images.boommap[boomIndex-1];
                }
                return Images.boommap[boomIndex];
            } else {
                return Images.boommap[boomIndex];
            }
        }
    }

    public int getScore() {
        return 10;
    }
}
